<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Feedback extends MY_Luckydog
{
    public function __construct()
    {
        parent::__construct();
        $login_status = $this->login_status = $this->check_login_status();
        if (empty($login_status)){
            redirect('/luckydog/login');
        }
        $this->load->model('luckydog/feedback_model', 'feedback');
    }
    public function index()
    {
        $_SESSION['v_menu'] =  'feedback';
        $starttime = $this->input->get("starttime",true)?$this->input->get("starttime",true):"";
        $endtime = $this->input->get("endtime",true)?$this->input->get("endtime",true):"";
        $contact = $this->input->get("contact",true)?$this->input->get("contact",true):"";
        $content = $this->input->get("contents",true)?$this->input->get("contents",true):"";
        $status = $this->input->get("status");
        $per_page = $this->input->get('per_page') ? $this->input->get('per_page') : 0;
        $filter = array(
            'starttime'=>strtotime($starttime),
            'endtime'=>strtotime($endtime),
            'contact'=>$contact,
            'content'=>$content,
            'status'=>$status
        );

        $limit = 20;
        $total_rows = $this->feedback->get_feedbact_cnt($filter);
        $base_url = '/luckydog/feedback/index?';
        $page_links = $this->create_page_links($base_url,$total_rows,$limit);
        $feedbackList = $this->feedback->feedbackList($filter);
        $data = array(
            'feedbackList'=>$feedbackList,
            'page_links'=>$page_links,
            'per_page'=>$per_page,
            'total_rows'=>$total_rows
        );
        $this->load->view("/luckydog/feedback/feedback",$data);
    }
    //删除反馈信息
    public function delFeedback(){
        $id = $this->input->post("id",true)?$this->input->post("id",true):"";
        $res = $this->feedback->delFeedback($id);
        echo $res;
    }



    //编辑状态信息
    public function edit_status(){
        $status = $this->input->post("status",true)?$this->input->post("status",true):"";
        $id = $this->input->post("id",true)?$this->input->post("id",true):"";
        $res = $this->feedback->edit_status($id,$status);
       echo $res;
    }
	
	
	public function contact()
	{
		$contactInfo = $this->feedback->getContactInfo();
		$data['contact'] = $contactInfo;
		$this->load->view("/luckydog/feedback/contact",$data);
	}
	
	


}
/* End of file index.php */
/* Location: ./application/controllers/luckydog/index.php */